﻿using Avalonia.Media.Imaging;
using MyTodo.Extensions;
using MyTodo.Services;
using MyTodo.Shared.Dtos;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyTodo.ViewModels
{
    public class InitViewModel : BindableBase, IDialogAware
    {
        #region Dialog相关方法和属性

        string IDialogAware.Title => "Todo";

        public event Action<IDialogResult> RequestClose;

        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {
            throw new NotImplementedException();
        }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            throw new NotImplementedException();
        }

        #endregion


        #region 属性
        public Bitmap? ImageInit { get; } = ImageHelper.LoadFromResource(new Uri("avares://MyTodo/Images/login.png"));


        private readonly IEventAggregator aggregator;


        public DelegateCommand<string> ExecuteCommand { get; private set; }

        private string account;

        public string Account
        {
            get { return account; }
            set { account = value; }
        }
        private string password;
        private readonly ILoginService service;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        private int selectedIndex;

        public int SelectedIndex
        {
            get { return selectedIndex; }
            set { selectedIndex = value; RaisePropertyChanged(); }
        }

        private RegisterDto userDto;

        public RegisterDto UserDto
        {
            get { return userDto; }
            set { userDto = value; RaisePropertyChanged(); }
        }

        #endregion

        public InitViewModel(ILoginService service, IEventAggregator aggregator)
        {
            userDto = new RegisterDto();
            //ExecuteCommand = new DelegateCommand<string>(Execute);
            this.service = service;
            this.aggregator = aggregator;
        }




    }
}
